package ${package.Entity};

import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import com.puruo.mindhall.bean.BaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import java.math.BigDecimal;
<#list table.importPackages as pkg>
<#if pkg == "java.util.Date">
import ${pkg};
</#if>
</#list>

/**
 * ${table.name} : ${table.comment!}
 * @author ${author}
 * @since ${date}
 */
public class ${entity} extends BaseEntity  implements Serializable {

	private static final long serialVersionUID = 1L;
<#-- ----------  属性私有化  ---------->
<#list table.fields as field>
    <#if field.keyFlag>
        <#assign keyPropertyName="${field.propertyName}"/>
    </#if>

    <#if field.keyFlag>
    <#-- 主键 -->
    /**
     * 主键 : ${field.comment!}
     */
    <#-- 普通字段 -->
    @JsonSerialize(using = ToStringSerializer.class)
    <#elseif !field.keyFlag>
    /**
     *  ${field.comment!}
     */
    </#if>
<#-- 乐观锁注解 -->
    <#if (versionFieldName!"") == field.name>
    @Version
    </#if>
<#-- 逻辑删除注解 -->
    <#if (logicDeleteFieldName!"") == field.name>
    @TableLogic
    </#if>
    <#if (field.propertyType!"") == "Date">
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    </#if>
    <#if field.propertyType == "LocalDateTime">
    private Date ${field.propertyName};
    </#if>
    <#if field.propertyType == "BigDecimal">
    private Long ${field.propertyName};
    </#if>
    <#if field.propertyType != "LocalDateTime" && field.propertyType != "BigDecimal">
    private ${field.propertyType} ${field.propertyName};
    </#if>
</#list>

<#------------  getter.setter封装  ---------->
<#if !entityLombokModel>
    <#list table.fields as field>
        <#if field.propertyType == "boolean">
            <#assign getprefix="is"/>
        <#else>
            <#assign getprefix="get"/>
        </#if>
    public <#if field.propertyType == "LocalDateTime">Date</#if><#if field.propertyType == "BigDecimal">Long</#if><#if field.propertyType != "LocalDateTime" && field.propertyType != "BigDecimal">${field.propertyType}</#if> ${getprefix}${field.capitalName}() {
        return ${field.propertyName};
    }


        <#if entityBuilderModel>
    public ${entity} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
        <#else>
    public void set${field.capitalName}(<#if field.propertyType == "LocalDateTime">Date</#if><#if field.propertyType == "BigDecimal">Long</#if><#if field.propertyType != "LocalDateTime" && field.propertyType != "BigDecimal">${field.propertyType}</#if> ${field.propertyName}) {
        </#if>
        this.${field.propertyName} = ${field.propertyName};
        <#if entityBuilderModel>
        return this;
        </#if>
    }
    </#list>
</#if>
}
